package Data_Structure.DataType;

import lombok.Data;
/**
 * The account class used only for billing functions
 *
 * @author Yibai Jiang
 * @author XiaorunWang
 * @since 30 March 2022
 * @version 1.0
 */
@Data
public class CreditCardAccount {
    /**
     * The name of the user.
     */
    private String name;

    /**
     * The ID number of the user.
     */
    private String personID;

    /**
     * The card ID number.
     */
    private String cardID;

    /**
     * The balance of the card.
     */
    private double balance;

    /**
     * The limit of the credit card.
     */
    private final double overdraftLimit = 1000;

    /**
     * Pay for the bill.
     * @param amount Amount payable
     * @return true for success and false for fail.
     */
    public boolean withdraw(double amount) {
        if (balance + overdraftLimit >= amount) {
            balance = balance - amount;
            return true;
        }else {
            System.out.println("Invalid operation: not enough money!");
            return false;
        }
    }

//    public CreditCardAccount(String name,String personID,String  cardID,double balance){
//        setName(name);
//        setPersonID(personID);
//        setCardID(cardID);
//        setBalance(balance);
//    }


}
